<template>
  <div>
    <div style="width: 100%;height: 300px;background-color:cornflowerblue;">
      父组件<br>
      count: <span>{{ count }}</span><br>
      <input type="button" @click="addCount" value="自增">
    </div>
    <div style="width: 100%;height: 300px;background-color: bisque;margin-top: 30px;">
      子组件
      <Test2 :count @test2add="addCount" />
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import Test2 from './Test2.vue';

let count = ref(1)
function addCount(){
  console.log('父组件+1');
  
  count.value++
}
</script>
